<?php
class order_systemController extends commonController {
    public function expressAction()
    {
        $origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
        $Config = Config::getInstance();
        $webSite = $Config->getWebSiteConfig();
        $url = substr($webSite['ganso_app_pc_url'],0,strrpos($webSite['ganso_app_pc_url'],'/'));
        $allow_origin = [
            $url,
        ];
        if(in_array($origin, $allow_origin)){
            header('Access-Control-Allow-Origin:'.$origin);
        }
        $str = base64_decode($this->params['app_zp']);
        $len = strlen($str);
        $Data['check_code'] = substr($str,0,16);
        $Data['ph_no'] = substr($str,16,$len-22);
        $file = 'order_system';
        self::WriteReception($file,$str);
        $validate = ['check_code'=>'check','ph_no'=>'string'];
        self::Verify($Data,$validate,$file,Data::$VERSION);
        $r = $this->model->express($Data);
        if($r['result']['status'] == 1 || $r['result']['status'] == 2){
            self::WriteResponse($file,$r['result']['status'],$r['result']['msg'],'');
        }
        self::WriteResponse($file,0,'',$r['result']);
    }

}